package cn.iocoder.yudao.module.trade.convert.lifecircle;

import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
import cn.iocoder.yudao.module.trade.controller.admin.lifecircle.vo.LifeCircleStoreSimpleRespVO;
import cn.iocoder.yudao.module.trade.controller.app.lifecircle.vo.AppLifeCircleStoreRespVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.lifecircle.LifeCircleStoreDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface LifeCircleStoreConvert {

    LifeCircleStoreConvert INSTANCE = Mappers.getMapper(LifeCircleStoreConvert.class);


    List<LifeCircleStoreSimpleRespVO> convertList1(List<LifeCircleStoreDO> list);

    @Mapping(source = "areaId", target = "areaName", qualifiedByName = "convertAreaIdToAreaName")
    LifeCircleStoreSimpleRespVO convert02(LifeCircleStoreDO bean);

    @Named("convertAreaIdToAreaName")
    default String convertAreaIdToAreaName(Integer areaId) {
        return AreaUtils.format(areaId);
    }

    @Mapping(source = "areaId", target = "areaName", qualifiedByName = "convertAreaIdToAreaName")
    AppLifeCircleStoreRespVO convert03(LifeCircleStoreDO bean);

}
